package com.mod.dao;

import java.math.BigInteger;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mod.db.DbcpBean;
import com.mod.pojo.user;


public class userDao  {
	private static Log log = LogFactory.getLog(userDao.class);
	private Connection conn=DbcpBean.getConn();

	public user fetchByID(String uid) {
		log.info("user.findByID("+uid+")");
		BigInteger id=BigInteger.valueOf(Long.valueOf(uid));
		String sql="SELECT users.ID as id,users.user_login,users.user_pass,users.user_nicename,users.user_email,users.user_url,"+
							"users.user_registered,users.display_name,users.user_status "+
							"FROM users "+
							"WHERE users.ID = '"+uid+"'";
		user au=new user();
		try{
			Statement st=conn.createStatement();
			ResultSet rs=st.executeQuery(sql);

//			au.setID( )
//			au.setUserLogin(userLogin);
//			au.setUserPass(userPass);
//			au.setUserEmail(userEmail);
//			au.setDisplayName(displayName);
//			au.setUserUrl(userUrl);
//			au.setUserStatus(userStatus);
			
		}catch(Exception e){
			log.error(e);
		}
		
		
		return au;
		
	}
	public static void main(String[] arg){
		userDao ad=new userDao();
		ad.fetchByID("1");
	}

}
